package com.yic.module.base.convert.item;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;

import com.yic.module.base.api.item.dto.ItemRespDTO;
import com.yic.module.base.dal.dataobject.itemCategory.ItemCategoryDO;
import com.yic.module.base.dal.dataobject.unit.UnitDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import com.yic.module.base.controller.admin.item.vo.*;
import com.yic.module.base.dal.dataobject.item.ItemDO;

/**
 * 产品通用信息 Convert
 *
 * @author 系统管理员
 */
@Mapper
public interface ItemConvert {

    ItemConvert INSTANCE = Mappers.getMapper(ItemConvert.class);

    ItemDO convert(ItemCreateReqVO bean);

    ItemDO convert(ItemUpdateReqVO bean);

    ItemRespVO convert(ItemDO bean);

    List<ItemRespVO> convertList(List<ItemDO> list);

    PageResult<ItemRespVO> convertPage(PageResult<ItemDO> page);

    List<ItemExcelVO> convertList02(List<ItemDO> list);

    @Mappings({
            @Mapping(source = "itemCategoryDO.name", target = "itemCategoryName"),
            @Mapping(source = "unitDO.name", target = "unitName"),
            @Mapping(source = "itemDO.name", target = "name"),
            @Mapping(source = "itemDO.code", target = "code"),
            @Mapping(source = "itemDO.remark", target = "remark"),
            @Mapping(source = "itemDO.status", target = "status"),
            @Mapping(source = "itemDO.creator", target = "creator"),
            @Mapping(source = "itemDO.createTime", target = "createTime"),
            @Mapping(source = "itemDO.id", target = "id")

    })
    ItemRespVO convert(ItemDO itemDO, ItemCategoryDO itemCategoryDO, UnitDO unitDO);

    ItemRespDTO convert01(ItemDO item);

    List<ItemRespDTO> convertList03(List<ItemDO> list);
}
